#ifndef DB_H
#define DB_H

#include <QObject>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QMessageBox>
#include <QString>
#include <QVariant>
#include <QDebug>
class DB : public QObject
{
    Q_OBJECT
public:
    explicit DB(QObject *parent = nullptr);
    static DB& getinstance();
    //析构函数断开连接
    ~DB();
private:
    //连接数据库
    QSqlDatabase m_db;
public:
    //初始化连接数据库
    void init();
    bool handleRegis(char* name,char* pwd);
    bool handleLogin(char* name,char* pwd);
    bool handleoffline(const char* name);
    QStringList handleAllUser();
    int handleSearchUsr(const char* name);
signals:

};

#endif // DB_H
